namespace OracleInternal.BinXml
{
	internal class ObxmlDocHeader : ObxmlStateObject
	{
		internal static readonly string sHeaderVersion = "<?xml version=\"1.0\"";

		internal static readonly string sHeaderTagEnd = "?>\n";

		internal static readonly string sHeaderVersion1 = "<?xml version=\"1.1\"";

		internal int Flags;

		internal string Version;

		internal string Standalone;

		internal string Encoding;

		internal bool XmlDecl;

		internal bool IsHeaderSubVersion1 => (Flags & ObxmlInstructionFormat.VERSION_MASK) > 0;

		internal ObxmlDocHeader()
		{
			ClearStateObject();
		}

		internal string GetHeaderString()
		{
			string empty = string.Empty;
			empty = ((!IsHeaderSubVersion1) ? sHeaderVersion : sHeaderVersion1);
			empty = ((!ObxmlDecodeContext.m_XMLTypeUseHeaderEncodingFromServer || string.IsNullOrEmpty(Encoding)) ? (empty + " encoding=\"UTF-16\"") : (empty + " encoding=\"" + Encoding + "\""));
			if (!string.IsNullOrEmpty(Standalone))
			{
				empty += " standalone='yes'";
			}
			return empty + sHeaderTagEnd;
		}

		internal override void ClearStateObject()
		{
			Version = null;
			Standalone = null;
			Encoding = null;
			XmlDecl = false;
		}
	}
}
